
package com.netease.xone.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;

import com.netease.pkgRelated.XoneConsts;
import com.netease.xone.R;
import com.netease.xone.fragment.FragmentFansList;
import com.netease.xone.fragment.FragmentFansList.FansListType;

public class ActivityFansList extends ActivityX1Base {

    private final String TAG = ActivityFansList.class.getSimpleName();

    public static void startActivity(Context context, String userId, FansListType type){
        Intent i = new Intent(context, ActivityFansList.class);
        i.putExtra(XoneConsts.BUNDLE_KEY.SOURCE_ID, userId);
        i.putExtra(XoneConsts.BUNDLE_KEY.FANS_LIST_TYPE, type);
        context.startActivity(i);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String userId = getIntent().getStringExtra(XoneConsts.BUNDLE_KEY.USER_ID);
        FansListType type = (FansListType)getIntent().getSerializableExtra(XoneConsts.BUNDLE_KEY.FANS_LIST_TYPE);
        switch(type){
            case fans:
                setTitle(R.string.my_fans);
                break;
            case follow:
                setTitle(R.string.my_follows);
                break;
        }
        FrameLayout frame = new FrameLayout(this);
        frame.setId(R.id.activity_fans_list_container_id);
        setContentView(frame);
        if (findViewById(R.id.activity_fans_list_container_id) != null && savedInstanceState == null) {
            Fragment f = FragmentFansList.newInstance(userId, type);
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.replace(R.id.activity_fans_list_container_id, f);
            ft.commit();
        }
    }

}
